<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"
	dir="ltr">
	<head>

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>"
			type="text/css" />

	</head>
	<body style="">
		<div class="head_content" id="headBar" style=""></div>
		<div class="main_content" id="main">
			<form class="tableform" id="mb_level_form"
				action="mb_level_save.html"
				method="post">
				<input type="hidden"  size="20"	name="memberLevel.mlId" value='${memberLevel.mlId}' class="x-input "  />
				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tbody>
							<tr>
								<th>
									等级名称：
								</th>
								<td>
									<input type="text"  size="20" value="${memberLevel.name}"	name="memberLevel.name" class="x-input "  />
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0"
						id="member_level">
						<tbody>
							<tr>
								<th>
									优惠百分比：
								</th>
								<td>
									<input value="${memberLevel.disCount }"   style="width: 50px;" name="memberLevel.disCount" class="x-input " />
										% <span class="notice-inline">如果输入80，表示该会员等级以销售价80%的价格购买。</span>
								</td>
							</tr>
							<tr>
								<th>
									是否为会员默认等级：
								</th>
								<td>
									<c:if test="${empty defaultMemberLevel}">
									<label>
										<input type="radio"  value="true"  <c:if test="${not empty memberLevel.mlId and memberLevel.defaultLevel  }">checked=""</c:if>    name="memberLevel.defaultLevel"  />
											是
									</label>
									&nbsp; &nbsp;
									<label>
										<input type="radio" value="false" <c:if test="${empty memberLevel.mlId or !memberLevel.defaultLevel  }">checked=""</c:if> name="memberLevel.defaultLevel" />
											否
									</label>
									</c:if>
									<c:if test="${not empty defaultMemberLevel}">
										<label>
										<input type="radio" disabled="disabled" value="true"  <c:if test="${not empty memberLevel.mlId and memberLevel.defaultLevel  }">checked=""</c:if>    name="memberLevel.defaultLevel"  />
											是
									</label>
									&nbsp; &nbsp;
										<label><input disabled="disabled" type="radio" value="false" checked="" name="memberLevel.defaultLevel" />
											否&nbsp; &nbsp;&nbsp; &nbsp;默认会员等级已存在&nbsp; &nbsp;若要把当前等级设置为默认会员，请先改变<strong><a href="mb_level_edit.html?mlId=${defaultMemberLevel.mlId}"> ${defaultMemberLevel.name }</a></strong>为非默认会员
									</label>
									</c:if>
								</td>
							</tr>

							<tr class="member_retail">
								<th>
									所需积分：
								</th>
								<td>
									<input type="text"  class="x-input _x_input"  value="${memberLevel.point}" style="width: 50px;"		name="memberLevel.point" />
										&nbsp; <span class="notice-inline">会员积分达到此标准后会自动升级为当前等级</span>
										
								</td>
							</tr>
							<tr class="member_retail">
								<th>
									描述：
								</th>
								<td>
									<textarea cols="80" id="editor1" name="memberLevel.lvRemark" rows="10">${memberLevel.lvRemark}</textarea>										
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="table-action">
					<button class="btn" type="submit">
						<span><span>保存</span>
						</span>
					</button>
				</div>
			</form>
		</div>
		<div class="foot_content" id="footBar" style="font-size: 0px;"></div>
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery.validate.js'/>"></script>
			<script type="text/javascript"
			src="<c:url value="/ckeditor/ckeditor.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/ckeditor/adapters/jquery.js"/>"></script>
		<script type="text/javascript">
		var config = {
		toolbar:
		[
			[ 'Bold', 'Italic', 'Underline', 'StrikeThrough', '-',
							'Subscript', 'Superscript' ],
					[ 'OrderedList', 'UnorderedList', '-', 'Outdent', 'Indent',
							'Blockquote' ],
					[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight',
							'JustifyFull' ],
					[ 'Link', 'Unlink', 'Anchor' ],
					[ 'Style', 'FontFormat', 'FontName', 'FontSize' ],
					[ 'Image', 'Table', 'Rule', 'Smiley',
							'SpecialChar' ], [ 'TextColor', 'BGColor'],['Source' ]
		],
		filebrowserImageUploadUrl : '<c:url value="/uploadFile.html?Type=Image"/>'
	};
	$('#editor1').ckeditor(config); 
	$(document).ready(function() {
		// validate signup form on keyup and submit
			var validator = $("#mb_level_form").validate( {
				errorElement : "div",
				errorClass : "x-vali-error",
				onfocusout : false,
				rules : {
					'memberLevel.name' : "required",
					'memberLevel.disCount' : {
						required : true,
						number : true
					},
					'memberLevel.point' : {
						required : true,
						number : true
					}
				},
				messages : {
					'memberLevel.name' : "必填字段",
					'memberLevel.disCount' : "请填入数字",
					'memberLevel.point' : "请填入数字" 
				},
				errorPlacement : function(error, element) {
					element.removeClass('x-vali-error');
					error.appendTo(element.parent());

				},

				//submitHandler: function() {
				//	alert("submitted!");
				//},

				success : function(div) {
					$(div).remove();
				}
			});
		});
</script>
	</body>
</html>